﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Xml.Linq;
//using Microsoft.Advertising.Mobile.UI;
using Common.Library;
using OnlineVideos.UI;
using OnlineVideos;
using OnlineVideos.Data;
using Common.Utilities;
using Common;
namespace OnlineVideos.Views
{
    public partial class HelpMenu : PhoneApplicationPage
    {
        #region Constructor
        public HelpMenu()
        {
            try
            {
            InitializeComponent();
            if (UtilitiesResources.ShowAdRotator != false && AppResources.ShowAdControl != true)
            {
                PageHelper.AdControlForPro(LayoutRoot, adstackpl);
            }
            else
            {
                PageHelper.LoadAdControl(LayoutRoot, adstackpl,2);
            }
            Loaded += new RoutedEventHandler(Help_Loaded);
            }
            catch (Exception ex)
            {

              Exceptions.SaveOrSendExceptions("Exception in HelpMenu Method In HelpMenu.cs file.", ex);
        }

        }
        #endregion
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            try
            {
                FlurryWP8SDK.Api.EndTimedEvent("HelpMenu Page");
            }
            catch (Exception ex)
            {

                Exceptions.SaveOrSendExceptions("Exception in OnNavigatedFrom Method In HelpMenu.cs file.", ex);
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            try
            {
                FlurryWP8SDK.Api.LogPageView();
            }
            catch (Exception ex)
            {

                Exceptions.SaveOrSendExceptions("Exception in OnNavigatedTo Method In HelpMenu.cs file.", ex);
            }
        }
        #region PageLoad
        void Help_Loaded(object sender, RoutedEventArgs e)
        {
            LoadAds();
            FlurryWP8SDK.Api.LogEvent("HelpMenu Page", true);
        lbxHelpMenu.ItemsSource = OnlineShow.LoadMenuList();
            
        }
        #endregion

        #region "Common Methods"

        private void LoadAds()
        {
            try
            {
                PageHelper.LoadAdControl(LayoutRoot, adstackpl, 2);
            }
            catch (Exception ex)
            {
                Exceptions.SaveOrSendExceptions("Exception in LoadAds Method In SongDetails file", ex);
                string excepmess = "Exception in LoadAds Method In SongDetails file.\n\n" + ex.Message + "\n\n StackTrace :- \n" + ex.StackTrace;
            }
            }
           

     

        #endregion

        #region Events
        private void lbxHelpMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
            if (lbxHelpMenu.SelectedIndex != -1)
            {
                MenuProperties selectedMenuItem = (lbxHelpMenu.SelectedItem as MenuProperties);
                NavigationService.Navigate(NavigationHelper.getHelpDetailPage(selectedMenuItem.Id, selectedMenuItem.Url));
            }
        }
            catch (Exception ex)
            {
                
                Exceptions.SaveOrSendExceptions("Exception in lbxHelpMenu_SelectionChanged Method In HelpMenu.cs file.", ex);
            }
        }
        private void imgTitle_MouseEnter(object sender, MouseButtonEventArgs e)
        {
            NavigationService.Navigate(NavigationHelper.MainPanoramaPage);
        }
        #endregion

    


    }
}